.class Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;
.super Ljava/lang/Object;
.source "RealSystemFacade.java"

# interfaces
.implements Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;


# static fields
.field private static final DOWNLOAD_MAX_BYTES_OVER_MOBILE:J = -0x80000000L

.field private static final DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE:J = 0x40000000L


# instance fields
.field private mContext:Landroid/content/Context;

.field private mNotificationManager:Landroid/app/NotificationManager;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 23
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 24
    iput-object p1, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    .line 25
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    const-string v1, "notification"

    .line 26
    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/NotificationManager;

    iput-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mNotificationManager:Landroid/app/NotificationManager;

    .line 27
    return-void
.end method


# virtual methods
.method public cancelAllNotifications()V
    .registers 2

    .prologue
    .line 108
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mNotificationManager:Landroid/app/NotificationManager;

    invoke-virtual {v0}, Landroid/app/NotificationManager;->cancelAll()V

    .line 109
    return-void
.end method

.method public cancelNotification(J)V
    .registers 6
    .param p1, "id"    # J

    .prologue
    .line 103
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mNotificationManager:Landroid/app/NotificationManager;

    long-to-int v1, p1

    invoke-virtual {v0, v1}, Landroid/app/NotificationManager;->cancel(I)V

    .line 104
    return-void
.end method

.method public currentTimeMillis()J
    .registers 3

    .prologue
    .line 30
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    return-wide v0
.end method

.method public getActiveNetworkType()Ljava/lang/Integer;
    .registers 6

    .prologue
    const/4 v2, 0x0

    .line 34
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    const-string v4, "connectivity"

    .line 35
    invoke-virtual {v3, v4}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/net/ConnectivityManager;

    .line 36
    .local v1, "connectivity":Landroid/net/ConnectivityManager;
    if-nez v1, :cond_15

    .line 37
    const-string v3, "DownloadManager"

    const-string v4, "couldn\'t get connectivity manager"

    invoke-static {v3, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 48
    :cond_14
    :goto_14
    return-object v2

    .line 41
    :cond_15
    invoke-virtual {v1}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v0

    .line 42
    .local v0, "activeInfo":Landroid/net/NetworkInfo;
    if-eqz v0, :cond_14

    .line 48
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    goto :goto_14
.end method

.method public getMaxBytesOverMobile()Ljava/lang/Long;
    .registers 3

    .prologue
    .line 71
    const-wide/32 v0, -0x80000000

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    return-object v0
.end method

.method public getRecommendedMaxBytesOverMobile()Ljava/lang/Long;
    .registers 3

    .prologue
    .line 76
    const-wide/32 v0, 0x40000000

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    return-object v0
.end method

.method public isNetworkRoaming()Z
    .registers 10

    .prologue
    const/4 v5, 0x1

    const/4 v6, 0x0

    .line 52
    iget-object v7, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    const-string v8, "connectivity"

    .line 53
    invoke-virtual {v7, v8}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    .line 54
    .local v0, "connectivity":Landroid/net/ConnectivityManager;
    if-nez v0, :cond_16

    .line 55
    const-string v5, "DownloadManager"

    const-string v7, "couldn\'t get connectivity manager"

    invoke-static {v5, v7}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 67
    :goto_15
    return v6

    .line 59
    :cond_16
    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v1

    .line 60
    .local v1, "info":Landroid/net/NetworkInfo;
    if-eqz v1, :cond_38

    invoke-virtual {v1}, Landroid/net/NetworkInfo;->getType()I

    move-result v7

    if-nez v7, :cond_38

    move v2, v5

    .line 61
    .local v2, "isMobile":Z
    :goto_23
    iget-object v7, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    const-string v8, "phone"

    .line 62
    invoke-virtual {v7, v8}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Landroid/telephony/TelephonyManager;

    .line 63
    .local v4, "mgr":Landroid/telephony/TelephonyManager;
    if-eqz v2, :cond_3a

    invoke-virtual {v4}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z

    move-result v7

    if-eqz v7, :cond_3a

    move v3, v5

    .local v3, "isRoaming":Z
    :goto_36
    move v6, v3

    .line 67
    goto :goto_15

    .end local v2    # "isMobile":Z
    .end local v3    # "isRoaming":Z
    .end local v4    # "mgr":Landroid/telephony/TelephonyManager;
    :cond_38
    move v2, v6

    .line 60
    goto :goto_23

    .restart local v2    # "isMobile":Z
    .restart local v4    # "mgr":Landroid/telephony/TelephonyManager;
    :cond_3a
    move v3, v6

    .line 63
    goto :goto_36
.end method

.method public postNotification(JLandroid/app/Notification;)V
    .registers 7
    .param p1, "id"    # J
    .param p3, "notification"    # Landroid/app/Notification;

    .prologue
    .line 98
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mNotificationManager:Landroid/app/NotificationManager;

    long-to-int v1, p1

    invoke-virtual {v0, v1, p3}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V

    .line 99
    return-void
.end method

.method public sendBroadcast(Landroid/content/Intent;)V
    .registers 4
    .param p1, "intent"    # Landroid/content/Intent;

    .prologue
    .line 81
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "sendBroadcast >>>>> "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {p1}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcom/zuimeia/sdk/download/utils/LogTimber;->d(Ljava/lang/String;[Ljava/lang/Object;)V

    .line 82
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    invoke-virtual {v0, p1}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V

    .line 83
    return-void
.end method

.method public startThread(Ljava/lang/Thread;)V
    .registers 2
    .param p1, "thread"    # Ljava/lang/Thread;

    .prologue
    .line 113
    invoke-virtual {p1}, Ljava/lang/Thread;->start()V

    .line 114
    return-void
.end method

.method public userOwnsPackage(ILjava/lang/String;)Z
    .registers 5
    .param p1, "uid"    # I
    .param p2, "packageName"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/content/pm/PackageManager$NameNotFoundException;
        }
    .end annotation

    .prologue
    const/4 v0, 0x0

    .line 88
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/RealSystemFacade;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    invoke-virtual {v1, p2, v0}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;

    move-result-object v1

    iget v1, v1, Landroid/content/pm/ApplicationInfo;->uid:I

    if-ne v1, p1, :cond_10

    const/4 v0, 0x1

    :cond_10
    return v0
.end method
